SetAxisGearInPos

從同步點開始命令從軸和主軸位置之間的齒輪比率。

注意:使用 SetGearInPos() 前主軸必須在恆定速度的移動狀態。

運作方式:

首先,從軸以 MoveAxisContinuousAbsolute 移動以正確的時間及速度到達 SlaveSyncPositionVelocity, Acceleration Deceleration 輸入即為此 MoveAxisContinuousAbsolute 移動所設,移動中的 StartSync 輸出為 TRUE,一旦此運動完成,InSync 輸出即為 TRUE。

GearInPos 設定檔:

語法

KsCommandStatus SetAxisGearInPos(
     int Master,
     int Slave,
     BOOL Permanent,
     double Ratio,
     McSource MasterValueSource,
     double MasterSyncPosition,
     double SlaveSyncPosition,
     McSyncMode SyncMode,
     double MasterStartDistance,
     double Velocity,
     double Acceleration,
     double Deceleration,
     double Jerk,
     McBufferMode BufferMode
);

參數

Master [in]:主軸索引。索引以零為起點;別名將影響此參數。

Slave [in]:從軸索引。索引以零為起點;別名將影響此參數。從軸之最大數量為 32 軸。

Permanent [in]:決定馬達停用後是否保留齒輪狀態。

TRUE:馬達停用但保留齒輪狀態,例如當主軸啟用時從軸也會跟著啟用,而當主軸發生錯誤從軸也會發生錯誤。

FALSE:馬達停用後不會保留齒輪狀態。

Ratio [in]:齒輪比例。例如若比例為 3:2,從屬裝置移動三個單位而主裝置移動兩個單位。

MasterValueSource [in]:定義同步的來源。請見 McSource 類型。

MasterSyncPosition [in]:從軸與主軸同步時主軸的位置。

SlaveSyncPosition [in]:從軸與主軸同步時從軸的位置。

SyncMode [in]:決定同步的方式。請見 McSyncMode 類型。

MasterStartDistance [in]:主軸移動至與從軸同步的距離(當從軸開始進入同步時)。

Velocity [in]:同步階段的最大速度。

Acceleration [in]:同步階段的最大加速度。

Deceleration [in]:同步階段的最大減速度。

Jerk [in]:同步階段的最大加加速度。

BufferMode [in]:定義如何融合兩功能的速度,請見 McBufferMode 類型。

回傳值

返回 KsCommandStatus 結構。

備註

範例

KsCommandStatus AssignGearSlave(INT Master, INT Slave, DOUBLE MasterPosition, DOUBLE SlavePosition) {
   KsCommandStatus gear = WaitForCommand(10, FALSE, SetAxisGearInPos(Master, Slave,
      False, //Parameter.Permanent
      1, //Gear ratio
      mcSetValue, /*Master Value Source. Value of the master position used.
                    Cam be the target position (commanded value and set value are identical)
                    or the actual position.*/
      MasterPosition, //The master's position where the slave is in sync with the master.
      SlavePosition, //The slave's position where the slave is in sync with the master.
      mcCatchUp, /*Defines the way to synchronize 
                   (such as "mcShortest," "mcCatchUp," "mcSlowDown"). Vendor-specific.*/
      0, //This will be calculated automatically if not provided.
      3600,
      36000,
      36000,
      3600000,
      mcAborting)
   );
   return gear;
}

使用需求

  RT Win32
最低支援版本 4.0 4.0
標頭檔 ksmotion.h ksmotion.h
程式庫 KsApi_Rtss.lib KsApi.lib

參見

PowerAxis

ReleaseAxis

SetAxisGear

StopAxis